const app = getApp()
import { currentDates } from '../../utils/util'
Page({
  data: {
    avatar: '',
  },
  onLoad(options) {
    const { avatar } = app.globalData.user
    this.setData({
      avatar,
    })
    this._getVip()
  },
  //  会员信息
  async _getVip() {
    let { code, data } = await wx.requestAsync({
      url: '/user/vip/info',
    })
    if (code == 0) {
      if (data.reach_at) {
        data.reach_at = currentDates(data.reach_at * 1000, 1)
      } else {
        data.reach_at = '无'
      }
      this.setData(data)
    }
  },
})
